package protocol.JT905_2014;

import java.util.HashMap;

public class Handle905_2014JT85 implements IHandle905_2014JT {
    @Override
    public String handle(JT_905_2014Cmd cmd) {
        byte subOrder = cmd.subOrder();

        switch (subOrder){
            case 0x00:
                return handle8500(cmd);
            default:
                return "905:未匹配的命令字"+(cmd.readOrder()+","+cmd.readSubOrder());
        }
    }

    private String handle8500(JT_905_2014Cmd cmd) {
        StringBuilder builder = new StringBuilder();
        builder.append("平台->终端:车辆控制");
        builder.append("\r\n");

        final int type = cmd.readInt(1);
        int order = cmd.readInt(1);
        switch (type){
            case 0:
                builder.append(order == 0?"恢复车辆油路":"断开车辆油路");
                break;
            case 1:
                builder.append(order == 0?"恢复车辆电路":"断开车辆电路");
                break;
            case 2:
                builder.append(order == 0?"车门解锁":"车门加锁");
                break;
            case 3:
                builder.append(order == 0?"车辆解锁":"车辆锁定");
                break;
        }
        builder.append("\r\n");
        return builder.toString();
    }
}
